package com.example.doudou.demos.utils;

import com.example.doudou.demos.pojo.enums.ErrorEnum;
import lombok.Data;

/**
 * @Author fangtao
 * @Date 2025 02 14 10 40
 * @Description
 **/
@Data
public class BusinessException extends RuntimeException {
    private String errorCode;
    private String errorMessage;

    public BusinessException(String message) {
        super(message);
    }

    public BusinessException(String errorCode, String message) {
        super(message);
        this.errorCode = errorCode;
    }
    public BusinessException(ErrorEnum errorEnum) {
        super(errorEnum.getErrorMessage());
        this.errorCode = errorEnum.getErrorCode();
    }

    public String getErrorCode() {
        return errorCode;
    }
}

